package com.xiaowei.gym.gymjsp.ware.service.impl;

import com.xiaowei.gym.gymjsp.ware.dao.AttendanceDao;
import com.xiaowei.gym.gymjsp.ware.dao.impl.AttendanceDaoImpl;
import com.xiaowei.gym.gymjsp.ware.entity.AttendanceEntity;
import com.xiaowei.gym.gymjsp.ware.service.AttendanceService;

import java.util.List;

public class AttendanceServiceImpl implements AttendanceService {

    private AttendanceDao attendanceDao;

    public AttendanceServiceImpl() {
        attendanceDao = new AttendanceDaoImpl();
    }

    @Override
    public int getCount() {

        return attendanceDao.getCount();
    }

    @Override
    public List<AttendanceEntity> getattendanceList(String employeeId, int currentPageNo, Integer pageSize) {
        return attendanceDao.getList(employeeId,currentPageNo,pageSize);
    }

    @Override
    public AttendanceEntity getByid(String aid) {
        return attendanceDao.getById(aid);
    }

    @Override
    public Boolean addAttendance(AttendanceEntity attendanceEntity) {
       int i = attendanceDao.createAttendance(attendanceEntity);
       if (i > 0){
           return true;
       }
       return false;
    }

    @Override
    public boolean modify(AttendanceEntity attendanceEntity) {
        int i = attendanceDao.updateAttendance(attendanceEntity);
        if (i > 0){
            return true;
        }
        return false;
    }
}
